package com.ruoyi.abuwx.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.abuwx.domain.AbuwxPersonageStatistics;
import com.ruoyi.abuwx.service.IAbuwxPersonageStatisticsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 个人统计Controller
 * 
 * @author tang
 * @date 2022-07-02
 */
@RestController
@RequestMapping("/abuwx/AbuwxPersonageStatistics")
public class AbuwxPersonageStatisticsController extends BaseController
{
    @Autowired
    private IAbuwxPersonageStatisticsService abuwxPersonageStatisticsService;

    /**
     * 查询个人统计列表
     */
    @PreAuthorize("@ss.hasPermi('abuwx:AbuwxPersonageStatistics:list')")
    @GetMapping("/list")
    public TableDataInfo list(AbuwxPersonageStatistics abuwxPersonageStatistics)
    {
        startPage();
        List<AbuwxPersonageStatistics> list = abuwxPersonageStatisticsService.selectAbuwxPersonageStatisticsList(abuwxPersonageStatistics);
        return getDataTable(list);
    }

    /**
     * 导出个人统计列表
     */
    @PreAuthorize("@ss.hasPermi('abuwx:AbuwxPersonageStatistics:export')")
    @Log(title = "个人统计", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, AbuwxPersonageStatistics abuwxPersonageStatistics)
    {
        List<AbuwxPersonageStatistics> list = abuwxPersonageStatisticsService.selectAbuwxPersonageStatisticsList(abuwxPersonageStatistics);
        ExcelUtil<AbuwxPersonageStatistics> util = new ExcelUtil<AbuwxPersonageStatistics>(AbuwxPersonageStatistics.class);
        util.exportExcel(response, list, "个人统计数据");
    }

    /**
     * 获取个人统计详细信息
     */
    @PreAuthorize("@ss.hasPermi('abuwx:AbuwxPersonageStatistics:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(abuwxPersonageStatisticsService.selectAbuwxPersonageStatisticsById(id));
    }

    /**
     * 新增个人统计
     */
    @PreAuthorize("@ss.hasPermi('abuwx:AbuwxPersonageStatistics:add')")
    @Log(title = "个人统计", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody AbuwxPersonageStatistics abuwxPersonageStatistics)
    {
        return toAjax(abuwxPersonageStatisticsService.insertAbuwxPersonageStatistics(abuwxPersonageStatistics));
    }

    /**
     * 修改个人统计
     */
    @PreAuthorize("@ss.hasPermi('abuwx:AbuwxPersonageStatistics:edit')")
    @Log(title = "个人统计", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody AbuwxPersonageStatistics abuwxPersonageStatistics)
    {
        return toAjax(abuwxPersonageStatisticsService.updateAbuwxPersonageStatistics(abuwxPersonageStatistics));
    }

    /**
     * 删除个人统计
     */
    @PreAuthorize("@ss.hasPermi('abuwx:AbuwxPersonageStatistics:remove')")
    @Log(title = "个人统计", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(abuwxPersonageStatisticsService.deleteAbuwxPersonageStatisticsByIds(ids));
    }
}
